i18n
Search Engine Optimization
- Use the
lang
attribute on the<html>
tag. - Include the locale in the URL (e.g en_US, zh_CN, etc).
- Webpages should use sth like
<link rel="alternate" hreflang="de" href="http://de.example.com/page.html" />
to tell search engines that there is another page at the specifiedhref
with the same content but for another language/ locale.
Locale vs Language
- Locale control how numbers, dates, and times display for your region: which may be a country, a portion of country or may not even honor country boundaries.
- Language can be different between locales e.g.
en_US
&en_GB
.
Predict locale but don't restrict
Servers can determine the locale/ language of visitors via a combination of HTTP Accept-Language
header and IP. However, predictions are not foolproof (especially if visitors are using VPNs) and visitors should still be allowed to change their country/language easily without hassle.